export async function post (url, body = {}) {
  return new Promise((resolve, reject) => {
    fetch(url, {
      method: 'POST',
      headers: {'Accept': 'application/json', 'Content-Type': 'application/json'},
      body: JSON.stringify(body)
    })
    .then((res) => res.json())
    .then((resData) => {
      resolve(resData)
    })
    .catch((err) => {
      resolve(err)
    })
  })
}

export async function get (url, body = {}) {
  return new Promise((resolve, reject) => {
    fetch(url)
    .then((res) => res.json())
    .then((resData) => {
      resolve(resData)
    })
    .catch((err) => {
      resolve(err)
    })
  })
}
